import dfbz.com.annotation.Table;
import dfbz.com.model.Dept;
import dfbz.com.model.User;
import dfbz.com.utils.JDBCUtil;
import org.apache.commons.dbutils.BasicRowProcessor;
import org.apache.commons.dbutils.GenerousBeanProcessor;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.RowProcessor;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.apache.commons.dbutils.handlers.MapHandler;
import org.junit.Test;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

public class test01 {
    @Test
    public void test(){
        System.out.println("111224 ");
    }

    @Test
    public void test2() {
        QueryRunner qr = new QueryRunner(JDBCUtil.getDataSource());
        //开启下划线->驼峰转换所用
        RowProcessor processor = new BasicRowProcessor(new GenerousBeanProcessor());
        List<Dept> deptList = null;
        try {
            deptList = qr.query("select * from dept", new BeanListHandler<>(Dept.class, processor));
        } catch (SQLException e) {
            e.printStackTrace();
        }
        System.out.println(deptList);
    }
}
